<?php
class User {
    private $user;
    function __construct(string $name, string $pwd, int $money)
    {
        if (empty($_SESSION['userinfo'])) {
            $this->user = array('name'=>$name, 'pwd'=>$pwd, 'money'=>$money);
            $_SESSION['userinfo'] = $this->user;
        } else {
            $this->user = $_SESSION['userinfo'];
        }
    }
    function getMoney()
    {
        return $this->user['money'];
    }
    function getName()
    {
        return $this->user['name'];
    }
};